package com.bd.scm.module.qywx.service;

import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ServletConfig {

    /**
     * 代码注册servlet(不需要@ServletComponentScan注解)
     * @return
     */

    @Bean
	 public OAuth2Servlet oAuth2Servlet(){
       return new OAuth2Servlet();
	 }

   @Bean
   public ServletRegistrationBean oAuth2ServletServletRegistrationBean() {
       // ServletName默认值为首字母小写，即myServlet1
   		ServletRegistrationBean registration = new ServletRegistrationBean(oAuth2Servlet());
       registration.setEnabled(true);
       registration.addUrlMappings("/oAuth2Servlet");
       return registration;
   }

   @Bean
	 public CoreServlet coreServlet(){
     return new CoreServlet();
	 }

   @Bean
   public ServletRegistrationBean coreServletServletRegistrationBean() {
	   // ServletName默认值为首字母小写，即myServlet1
 		ServletRegistrationBean registration = new ServletRegistrationBean(coreServlet());
 		registration.setEnabled(true);
 		registration.addUrlMappings("/coreServlet");
 		return registration;
   }
}
